import { axios } from "../../utils/request";

const api = {
    pageList: "/crm/contract/page",
    save: "/crm/contract/save",
    disable: "/crm/contract/disable",
    enable: "/crm/contract/enable",
    delete: "/crm/contract/delete",
    getTemplateDetail: "/crm/contract/getTemplateDetail",
    getTemplateList: "/crm/contract/getTemplateList",
    saveContractTemplate: "/crm/contract/saveContractTemplate",
    deleteContractTemplate: "/crm/contract/deleteContractTemplate"
};

/**
 * 合同列表
 */
 export function pageList(parameter) {
  return axios({
    url: api.pageList,
    method: "get",
    params: parameter
  });
}

/**
 * 保存合同
 */
 export function save(parameter) {
  return axios({
    url: api.save,
    method: "post",
    data: parameter
  });
}

/**
 * 停用
 */
 export function disable(parameter) {
  return axios({
    url: api.disable,
    method: "get",
    params: parameter
  });
}

/**
 * 启用
 */
export function enable(parameter) {
  return axios({
    url: api.enable,
    method: "get",
    params: parameter
  });
}

/**
 * 删除
 */
export function deleteContract(parameter) {
  return axios({
    url: api.delete,
    method: "delete",
    params: parameter
  });
}

/**
 * 合同模版详情
 */
 export function getTemplateDetail(parameter) {
  return axios({
    url: api.getTemplateDetail,
    method: "get",
    params: parameter
  });
}

/**
 * 合同模版列表
 */
 export function getTemplateList(parameter) {
  return axios({
    url: api.getTemplateList,
    method: "get",
    params: parameter
  });
}

/**
 * 保存合同模版
 */
 export function saveContractTemplate(parameter) {
  return axios({
    url: api.saveContractTemplate,
    method: "post",
    data: parameter
  });
}

/**
 * 删除合同模版
 */
 export function deleteContractTemplate(parameter) {
  return axios({
    url: api.deleteContractTemplate,
    method: "delete",
    params: parameter
  });
}